It is usually desirable to make scripted changes undoable as well as user interface changes. This is just one more reason that your primary undo support should be in your model objects. Since scripting is usually directed at the model, if your undo support is in your model primitives, then scripted changes can be undone. Being able to undo scripted changes is actually most important with macro-like scripts where the script is being used to automate relatively small tasks that are interspersed with direct user manipulation. Especially in these cases, you want the scripted changes recorded along with the direct user changes for the same reason: it is important to have all changes to a document recorded. If an application doesn't do this, a document can easily become inconsistent with the undo stack.